package com.lehecai.core.api.staticapi;

import com.lehecai.core.IntegerBeanLabelItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author Sunshow
 *
 */
public class StaticApiType extends IntegerBeanLabelItem {

	private static final Logger logger = LoggerFactory.getLogger(StaticApiType.class.getName());

    private static final long serialVersionUID = 6149659912325074046L;


    private static List<StaticApiType> items = new ArrayList<StaticApiType>();
    private static List<StaticApiType> _items;

	protected StaticApiType(String name, int value) {
		super(StaticApiType.class.getName(), name, value);
		items.add(this);
	}
	
	public static StaticApiType getItem(int value){
		try {
			return (StaticApiType) StaticApiType.getResult(StaticApiType.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<StaticApiType> getItems() {
		return _items;
	}

	public static final StaticApiType DEFAULT = new StaticApiType("默认", 0);
	public static final StaticApiType LOTTERY_CURRENT = new StaticApiType("当前期", 1);
    public static final StaticApiType LOTTERY_LATESTDRAWN = new StaticApiType("最新开奖期", 2);

    static {
        _items = Collections.unmodifiableList(items);
    }
	
}
